<!DOCTYPE HTML>
<html class="help-html">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>添加就诊人</title>
    <link rel="stylesheet" type="text/css" href="css/swiper.min.css" />
	  <link href="css/choose.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/aui.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body class="help-body">
    <div class="site-name">
      <p>北京114预约挂号平台</p>
    </div>

    <div class="add-container">
      <div class="add-wrapper">
        <div class="add-title">
          <h4>就诊人信息</h4>
        </div>
        <form >
        <div class="add-list">
          <div class="add-item">
            <div class="add-left">
              <p>*就诊人姓名</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入就诊人姓名" id = "thePatientName" name="jname"/>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*证件类型</p>
            </div>
            <div class="add-right">
              <div class="add-input sele-bp-1">
                <input  placeholder="点击选择证件类型"  id = "idType" name="jtype"/>
              </div>
              <div class="display-none">
                <div vid="居民身份证(包含现役军人、人民武装警察)">居民身份证(包含现役军人、人民武装警察)</div>
                <div vid="港澳居民来往内地通行证">港澳居民来往内地通行证</div>
                <div vid="台湾居民来往大陆通行证">台湾居民来往大陆通行证</div>
                <div vid="护照">护照</div>
                <div vid="外国人永久居留身份证">外国人永久居留身份证</div>
                <div vid="港澳居民居住证">港澳居民居住证</div>
                <div vid="台湾居民居住证">台湾居民居住证</div>
              </div>
              <i class="aui-iconfont aui-icon-right"></i>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*证件号码</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入证件号码"  id ="idNum" name="jTnum"/>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*性别</p>
            </div>
            <div class="add-right">
              <div class="add-input" id="sex">
                <input class="radio_type" type="radio" name="type1" checked="checked" value="男"/>
                <label>男</label>
                <input class="radio_type" type="radio" name="type1" value="女">
                <label>女</label>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*手机号</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入手机号"  id="mobileNum" name="jPnum"/>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*当前住址</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="点击选择省市区" value="**" id="address" name="jress"/>
              </div>
            </div>
          </div>


          <div class="add-item">
            <div class="add-left">
              <p>*详细地址</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="应公安机关要求，请填写真实住址"  id="detailedAddress" name="jlress"/>
              </div>
            </div>
          </div>


        </div>

        <div class="add-title">
          <h4>建档信息</h4>
        </div>

        <div class="add-list">

<!--          <div class="add-item">
            <div class="add-left">
              <p>*民族</p>
            </div>
            <div class="add-right">
              <div class="add-input sele-bp-2">
                <input placeholder="点击选择民族"/>
              </div>
              <div class="display-none">
                <div vid="汉族">汉族</div>
                <div vid="蒙古族">蒙古族</div>
                <div vid="回族">回族</div>
                <div vid="藏族">藏族</div>
                <div vid="维吾尔族">维吾尔族</div>
                <div vid="苗族">苗族</div>
                <div vid="彝族">彝族</div>
                <div vid="壮族">壮族</div>
              </div>
              <i class="aui-iconfont aui-icon-right"></i>
            </div>
          </div>-->

          <div class="add-item">
            <div class="add-left">
              <p>*民族</p>
            </div>
            <div class="add-right">
              <div class="add-right">
                <div class="add-input">
                  <input type="text" placeholder="请输入民族"  id="nation" name="jnation"/>
                </div>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*婚姻状况</p>

            </div>
            <div class="add-right">
              <div class="add-input">
                <input class="radio_type" type="radio" name="type3" checked="checked" id="" value="0"/>
                <label>未婚</label>
                <input class="radio_type" type="radio" name="type3" value="1"/>
                <label>已婚</label>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*户口所在地</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入省市区" id="picker2" name="jpick"/>
              </div>
            </div>
          </div>
          <div class="add-item">
            <div class="add-left">
              <p>*专程来京就医</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input class="radio_type" type="radio" name="type2" checked="checked" value="0"/>
                <label>是</label>
                <input class="radio_type" type="radio" name="type2" value="1"/>
                <label>否</label>
              </div>
            </div>
          </div>

        </div>

        <div class="add-title">
          <h4>联系人信息</h4>
        </div>

        <div class="add-list">
          <div class="add-item">
            <div class="add-left">
              <p>*联系人姓名</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入联系人姓名"  id="contactName" name="jplname"/>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*联系人证件类型</p>
            </div>
            <div class="add-right">
              <div class="add-input sele-bp-3">
                <input type="text" placeholder="点击选择联系人证件类型"  id="contactIdType" name="jttype"/>
              </div>
              <div class="display-none">
                <div vid="居民身份证(包含现役军人、人民武装警察)">居民身份证(包含现役军人、人民武装警察)</div>
                <div vid="港澳居民来往内地通行证">港澳居民来往内地通行证</div>
                <div vid="台湾居民来往大陆通行证">台湾居民来往大陆通行证</div>
                <div vid="护照">护照</div>
                <div vid="外国人永久居留身份证">外国人永久居留身份证</div>
                <div vid="港澳居民居住证">港澳居民居住证</div>
                <div vid="台湾居民居住证">台湾居民居住证</div>
              </div>
              <i class="aui-iconfont aui-icon-right"></i>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*联系人证件号码</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入联系人证件号码"   id="contactIdNum" name="jllnum"/>
              </div>
            </div>
          </div>

          <div class="add-item">
            <div class="add-left">
              <p>*联系人手机号</p>
            </div>
            <div class="add-right">
              <div class="add-input">
                <input type="text" placeholder="请输入联系人手机号"  id="contactPhone" name="jcpnum"/>
              </div>
            </div>
          </div>

        </div>

        <div class="add-btn">
          <a href="#" id="patients">添加就诊人</a>
        </div>
        </form>
      </div>
    </div>
</body>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/swiper.min.js"></script>
<script src="js/hSdrop.js"></script>
<script src="js/picker.min.js"></script>
<script type="text/javascript" src="js/city.js"></script>
<script type="text/javascript" src="js/add.js"></script>

<script>

  // 出生年月
  var pattern = /^((19[2-9]\d{1})|(20((0[0-9])|(1[0-8]))))\-((0?[1-9])|(1[0-2]))\-((0?[1-9])|([1-2][0-9])|30|31)$/;
  // 验证身份证格式
  var idcardReg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
  // 验证手机号
  var regPhone=/^1\d{10}$/;//手机号
  $(function () {
    $("#idNum").blur(function () {
      var message = $(this).val();
      if (!(idcardReg.test(message))){
        $(this).css("color","red");
        alert("你的身份证格式错误请输入正确的身份正格式");
      }else {
        $(this).css("color","black");
      }
    });
    $("#mobileNum").blur(function () {
      var phone = $(this).val();
      if (!(regPhone.test(phone))){
        $(this).css("color","red");
        alert("你的手机号格式错误");
      }else{
        $(this).css("color","black");
      }
    });
    // $("#birth").blur(function () {
    //   var birth = $(this).val();
    //   if (!(pattern.test(birth))){
    //     $(this).css("color","red");
    //     alert("请输入正确的日期格式");
    //   }else {
    //     $(this).css("color","black");
    //   }
    // })

    $("#contactIdNum").blur(function () {
      var contactIdNum = $(this).val();
      if (!(idcardReg.test(contactIdNum))){
        $(this).css("color","red");
        alert("你的联系人证件号错误");
      }else{
        $(this).css("color","black");
      }
    });
    $("#contactPhone").blur(function () {
      var contactPhone = $(this).val();
      if (!(regPhone.test(contactPhone))){
        $(this).css("color","red");
        alert("你的联系人手机号错误");
      }else{
        $(this).css("color","black");
      }
    });
    $("#patients").click(function () {
      var openid = localStorage.getItem("openid");
      var thePatientName = $("#thePatientName").val(); //就诊人姓名
      var idType = $("#idType").val();//证件类型
      var idNum = $("#idNum").val(); //证件号码
      var sex = $("input[name='type1']:checked").val();//性别
      var mobileNum = $("#mobileNum").val(); //手机号
      var address = $("#address").val(); //住址
      var detailedAddress = $("#detailedAddress").val();//详细地址
      var marriageType = $("input[name='type3']:checked").val();//0未婚；1已婚
      var trip = $("input[name='type2']:checked").val();//专程来京就医 0是; 1不是
      var contactName = $("#contactName").val();//联系人姓名
      var contactIdType = $("#contactIdType").val();//联系人证件类型
      var contactIdNum = $("#contactIdNum").val();//联系人证件号
      var contactPhone = $("#contactPhone").val();//联系人手机号
      var nation = $("#nation").val();//就诊人民族
      if(!(thePatientName!="" && idType!="" && idNum!="" && sex!="" && mobileNum!="" && address!="" && detailedAddress!="" && marriageType!="" && trip!="" && contactName!="" && contactIdType!="" && contactIdNum!="" && contactPhone!="" && nation!="") ){
        alert("所有信息都必须填写");
        return false;
      }
      $.ajax({
        type:"post",
        url:"http://guowang.nat300.top/wechat114/thepatients/insertThepatients",
        data:{"thepatientname":thePatientName,
          "idtype":idType,
          "idnum":idNum,
          "sex":sex,
          "mobilenum":mobileNum,
          "address":address,
          "detailedaddress":detailedAddress,
          "marriagetype":marriageType,
          "contactname":contactName,
          "contactidtype":contactIdType,
          "contactidnum":contactIdNum,
          "contactphone":contactPhone,
          "nation":nation,
          "trip":trip,
          "wxuseropenid":openid
        },
        dataType:"json",
        success:function (data) {
          if (data.code == 0){
              location.href = "submit.html?"+$("form").serialize();
          }
        }
      })
    })
  });
  $("#quit").click(function () {
    location.href = "user.html";
  });
</script>
<script type="text/javascript">
	new hSdrop({
		els:'.sele-bp-1'
	})

  new hSdrop({
		els:'.sele-bp-2'
	})

  new hSdrop({
		els:'.sele-bp-3'
	})
</script>
</html>
